
def linear_congruential_generator(seed):
    x0 = seed
    a = 17
    b = 26
    c = 10000
    while True:
        if input()=='':
            x1 = (a*x0+b)%c
            print(x1,end='')
            x0 = x1
        else:
            break

if __name__=='__main__':
    linear_congruential_generator(12)
